package com.itheima.api.treeset.demo07;

import java.util.Scanner;
import java.util.TreeSet;

public class TreeSetDemo01 {

    public static void main(String[] args) {

        TreeSet<Student> treeSet = new TreeSet<Student>();

        Scanner sc = new Scanner(System.in);
        for(int i = 0; i < 3; i++) {
            System.out.println("请输入第" + (i+1) + "个学生的姓名：");
            String name = sc.next();

            System.out.println("请输入第" + (i+1) + "个学生的语文成绩：");
            String chineseScoreStr = sc.next();

            System.out.println("请输入第" + (i+1) + "个学生的数学成绩：");
            String mathScoreStr = sc.next();

            System.out.println("请输入第" + (i+1) + "个学生的英语成绩：");
            String englishScoreStr = sc.next();

            Student s = new Student();
            s.setName(name);
            s.setChineseScore(Integer.parseInt(chineseScoreStr));
            s.setMathScore(Integer.parseInt(mathScoreStr));
            s.setEnglishScore(Integer.parseInt(englishScoreStr));

            treeSet.add(s);

        }

        for(Student s : treeSet) {
            System.out.println(s.getName() + "----" + s.getTotal() + "----" + s.getChineseScore() + "----" + s.getMathScore() + "----" + s.getEnglishScore());
        }

    }

}
